@tool
class_name CircularBar
extends Range

@export var color: Color = Color.GREEN

func _enter_tree() -> void:
	queue_redraw()


func _value_changed(_new_value: float) -> void:
	queue_redraw()


func _draw() -> void:
	var rect := get_rect()
	rect.position = Vector2.ZERO
	var radius := 0.5 * minf(rect.size.x, rect.size.y)
	draw_arc(rect.get_center(), 0.7 * radius, 0, TAU * (value / max_value), 28, color, 0.6 * radius, true)
